package demo7;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;



@Component
public class Person {
    private String name;
    public Person(){
        System.out.println("1:Person的构造器被调用了");
    }
    @Value("张三")
    public void setName(String name){
        System.out.println("2:Person的setName方法被调用了");
    }
    @PostConstruct
    public void init(){
        System.out.println("3:Person被容器初始化掉了");
    }
    @PreDestroy
    public void preDestory(){
        System.out.println("Person:容器即将销毁");
    }
    public void play(){
        System.out.println("Person的play()方法被调用了");
    }


}
